<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<!--这meta的作用就是删除默认的苹果工具栏和菜单栏。-->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<!--在web app应用下状态条（屏幕顶部条）的颜色-->
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<!--该标签用于指定是否将网页内容中的手机号码显示为拨号的超链接。-->
<meta name="format-detection" content="telephone=no"/>
<!--网页在任何时候都不能被Cache存储-->
<meta http-equiv="Expires" content="-1"/>
<!--清除缓存-->
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<title></title>
<link href="${ctx}/static/newweb/css/twy.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/top.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/footer.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/dropload.css" rel="stylesheet" type="text/css" />
<script src="${ctx}/static/newweb/js/jquery-1.8.0.min.js"></script>
<script language="javascript" type="text/javascript" src="${ctx}/static/newweb/js/dropload.min.js"></script>
</head>

<body>
<div class="top">
<%if(session.member.id == person.id){%>我关注的问题<%}else{%>${person.nickname!}关注的问题<%}%>
</div>
<div class="topbox"></div>
<div class="viewport">
<div id="main">
</div>
</div>
<div class="bottom"></div>
<div class="footer">
    <a href="${ctx}/wechatapi/portal" class="footerl"><img src="${ctx}/static/newweb/img/zhuye.png" /></a>
    <a href="${ctx}/wechatapi/search" class="footerr"><img src="${ctx}/static/newweb/img/sousuo.png" /></a>
</div>
<div class="fix">
<a href="${ctx}/wechatapi/ask">问</a>
</div>

<script language="javascript" type="text/javascript">
$(function(){
	$('li').click(function(){
		$('li').attr('class','');
		$(this).siblings().attr('class','color');
		$(this).attr('class','current');
	});
    var sum = 0;
    var counter = 0;
    // 每页展示4个
    var num = 4;
    var pageStart = 0,pageEnd = 4;
    var dropload = $('.viewport').dropload({
        scrollArea : window,
        domDown : {
            domClass   : 'dropload-down',
            domRefresh : '<div class="dropload-refresh">↓下拉加载更多</div>',
            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
            domNoData  : '<div class="dropload-noData">加载完毕</div>'
        },
        loadDownFn : function(me){
            $.ajax({
                type: 'GET',
                url: '${ctx}/wechatapi/ajaxfollowask?mid=${person.id!}&pageCurrent='+(counter+1),
                dataType: 'json',
                success: function(data){
                        var result = '';
                        counter++;
                        for(var i = pageStart; i < pageEnd; i++){
                        	if (i <= data.pageData.length-1){
                        		sum++;
                        		var iurl = "";
                        		if (data.pageData[i].img == null){
                        			iurl="${ctx}/static/newweb/img/wechat.png";
                        		}else{
                        			iurl=data.pageData[i].img+'46';
                        		}
                        		var type = 0;
                        		if (data.pageData[i].typeid == 1){
                        			type = "管理";
                        		}else if (data.pageData[i].typeid == 2){
                        			type = "财务";
                        		}else if (data.pageData[i].typeid == 3){
                        			type = "行政";
                        		}else if (data.pageData[i].typeid == 4){
                        			type = "业务";
                        		}else if (data.pageData[i].typeid == 0){
                        			type = "未知";
                        		}
                        		var title="";
                        		if (data.pageData[i].title!=null){
                        			if (data.pageData[i].title.length>=30){
                        				title=data.pageData[i].title.substring(0 , 30);
                        				title +='......';
                        			}else{
                        				title=data.pageData[i].title;
                        			}                           			
                        		}
                        		var content="";
                        		if (data.pageData[i].content!=null){
                        			if (data.pageData[i].content.length>=60){
                        				content=data.pageData[i].content.substring(0 , 60);
                        				content +='......';
                        			}else{
                        				content=data.pageData[i].content;
                        			}                           			
                        		}
                        		content = content.replace('\n','<br/>');
                        		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                        		       +'<span>来自'+type+'</span></div><div class="gn">'
                        		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                        		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                        		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                        		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                        		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                        		
                        	}
                            if(sum == data.totalRow){
                            	counter = counter-1;
                                // 锁定
                                me.lock();
                                // 无数据
                                me.noData();
                                break;
                            }
                        }
                        // 为了测试，延迟1秒加载
                        setTimeout(function(){
                        	$('#main').append(result);
                            // 每次数据加载完，必须重置
                            me.resetload();
                        },100);                         
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });        	
        }
    });	
})
</script>
</body>
</html>
